package com.yjd.comm.borrow.model;

import com.yjd.comm.base.model.Model;
import com.yjd.comm.borrow.enums.RaiseInterestVolumeStatusEnum;
import com.yjd.comm.util.FrameUtil;

/**
 * <b>description</b>：加息券表模型<br>
 * <b>time</b>：2015-05-11 09:15:34 <br>
 * <b>author</b>： ready likun_557@163.com
 */
public class RaiseInterestVolumeModel extends Model {

	/**
	 * @Fields serialVersionUID
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * 编号，主键，自动增长
	 */
	private Long id;
	/**
	 * 加息比例，1表示百分之一
	 */
	private Double rate;
	/**
	 * 类型，加息券类型，可以参考RaiseInterestVolumeTypeEnum
	 */
	private Integer type;
	/**
	 * 投标记录id
	 */
	private Long invest_id;
	/**
	 * 标的id
	 */
	private Long borrow_id;
	/**
	 * 会员id
	 */
	private Long user_id;
	/**
	 * 状态，0:未使用，1:已使用，默认为0
	 */
	private Integer status;
	/**
	 * 有效开始时间，默认为0
	 */
	private Long start_time;
	/**
	 * 有效结束时间，默认为0
	 */
	private Long end_time;
	/**
	 * 创建时间，默认为0
	 */
	private Long add_time;
	/**
	 * 最后更新时间，默认为0
	 */
	private Long up_time;

	/**
	 * 说明
	 */
	private String description;

	public RaiseInterestVolumeModel() {
	}

	public RaiseInterestVolumeModel(Double rate, Integer type, Long invest_id, Long borrow_id, Long user_id, Integer status, Long start_time, Long end_time, Long add_time,
			Long up_time, String description) {
		this.rate = rate;
		this.type = type;
		this.invest_id = invest_id;
		this.borrow_id = borrow_id;
		this.user_id = user_id;
		this.status = status;
		this.start_time = start_time;
		this.end_time = end_time;
		this.add_time = add_time;
		this.up_time = up_time;
		this.description = description;
		this.version = 0L;
	}

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public Double getRate() {
		return rate;
	}

	public void setRate(Double rate) {
		this.rate = rate;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public Long getInvest_id() {
		return invest_id;
	}

	public void setInvest_id(Long invest_id) {
		this.invest_id = invest_id;
	}

	public Long getBorrow_id() {
		return borrow_id;
	}

	public void setBorrow_id(Long borrow_id) {
		this.borrow_id = borrow_id;
	}

	public Long getUser_id() {
		return user_id;
	}

	public void setUser_id(Long user_id) {
		this.user_id = user_id;
	}

	public Integer getStatus() {
		if (this.getEnd_time() < FrameUtil.getTime(null)) {
			this.status = RaiseInterestVolumeStatusEnum.EXPIRED.getValue();
		}
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Long getStart_time() {
		return start_time;
	}

	public void setStart_time(Long start_time) {
		this.start_time = start_time;
	}

	public Long getEnd_time() {
		return end_time;
	}

	public void setEnd_time(Long end_time) {
		this.end_time = end_time;
	}

	public Long getAdd_time() {
		return add_time;
	}

	public void setAdd_time(Long add_time) {
		this.add_time = add_time;
	}

	public Long getUp_time() {
		return up_time;
	}

	public void setUp_time(Long up_time) {
		this.up_time = up_time;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
}
